package com.cloud.qualitycontrol.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Entity
@Table(name = "t_quality_node")
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
@EntityListeners(AuditingEntityListener.class)
public class QualityNode {

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    private String id;
    private String name;
    private String description;
    private String rootId;
    private String parentId;
    private boolean isAvailable;                    //是否可用
    private String type;                            //类型
    @CreatedDate
    private Long createTime;                        //创建时间

    public QualityNode setId(String id) {
        this.id = id;
        return this;
    }

    public QualityNode setName(String name) {
        this.name = name;
        return this;
    }

    public QualityNode setDescription(String description) {
        this.description = description;
        return this;
    }

    public QualityNode setRootId(String rootId) {
        this.rootId = rootId;
        return this;
    }

    public QualityNode setParentId(String parentId) {
        this.parentId = parentId;
        return this;
    }

    public QualityNode setAvailable(boolean available) {
        isAvailable = available;
        return this;
    }

    public QualityNode setType(String type) {
        this.type = type;
        return this;
    }

    public QualityNode setCreateTime(Long createTime) {
        this.createTime = createTime;
        return this;
    }
}
